home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / c / advc11.zip / INPUT.C < prev    next >
C/C++ Source or Header  |  1987-02-07  |  2KB  |  104 lines

  1. char getkey(str)
  2.    char *str;
  3. {
  4.    char c, *s;
  5.    int done = 0;
  6.  
  7.    while (!done) {
  8.       if (islower(c = getch()))
  9.          c = toupper(c);
  10.       if (*str) {
  11.          s = str;
  12.          while (*s && !done)
  13.             done = (c == *s++);
  14.          }
  15.       else done = 1;
  16.       }
  17.    return(c);
  18. }
  19.  
  20.  
  21.  
  22. int mousebuttons()                    /* see if mouse buttons are pressed */
  23. {
  24.    union REGS inregs;
  25.    union REGS outregs;
  26.    inregs.x.ax = 6;
  27.    int86(0x33,&inregs,&outregs);
  28.    return(outregs.x.ax & 3);
  29. }
  30.  
  31.  
  32.  
  33. int mousecheck()                      /* see if mouse exists, & # of buttons */
  34. {
  35.    union REGS inregs;
  36.    union REGS outregs;
  37.    inregs.x.ax = 0;
  38.    int86(0x33,&inregs,&outregs);
  39.    return(outregs.x.ax ? outregs.x.bx : 0);
  40. }
  41.  
  42.  
  43.  
  44. int mouseclick()                      /* see if mouse buttons were clicked */
  45. {
  46.    int click = 0;
  47.    union REGS inregs;
  48.    union REGS outregs;
  49.    inregs.x.ax = 5;
  50.    inregs.x.bx = 1;
  51.    int86(0x33,&inregs,&outregs);
  52.    click = outregs.x.bx << 1;
  53.    inregs.x.bx--;
  54.    int86(0x33,&inregs,&outregs);
  55.    return(click | outregs.x.bx);
  56. }
  57.  
  58.  
  59.  
  60. int mousecol()                        /* get column where mouse cursor is */
  61. {
  62.    union REGS inregs;
  63.    union REGS outregs;
  64.    inregs.x.ax = 3;
  65.    int86(0x33,&inregs,&outregs);
  66.    return(outregs.x.cx);
  67. }
  68.  
  69.  
  70.  
  71. void mousecursor(toggle)              /* turn mouse cursor on or off */
  72.    int toggle;
  73. {
  74.    union REGS inregs;
  75.    union REGS outregs;
  76.    if (toggle) inregs.x.ax = 1;
  77.    else inregs.x.ax = 2;
  78.    int86(0x33,&inregs,&outregs);
  79. }
  80.  
  81.  
  82.  
  83. void mouseloc(column,row)             /* set location of mouse cursor */
  84.    int column, row;
  85. {
  86.    union REGS inregs;
  87.    union REGS outregs;
  88.    inregs.x.ax = 4;
  89.    inregs.x.cx = column;
  90.    inregs.x.dx = row;
  91.    int86(0x33,&inregs,&outregs);
  92. }
  93.  
  94.  
  95.  
  96. int mouserow()                        /* get row where mouse cursor is */
  97. {
  98.    union REGS inregs;
  99.    union REGS outregs;
  100.    inregs.x.ax = 3;
  101.    int86(0x33,&inregs,&outregs);
  102.    return(outregs.x.dx);
  103. }
  104.